package com.walle.concurrenttest.pattern.future;

/**
 * @author zhangjiapeng
 * @Package com.walle.concurrenttest.pattern.future
 * @Description: ${todo}
 * @date 2019/2/25 14:55
 */
public class Main {

    public static void main(String[] args) {
        Host host = new Host();

        FutureData futureDataA = host.request(10,'A');
        FutureData futureDataB = host.request(10,'B');
        FutureData futureDataC = host.request(10,'C');
        System.out.println("main sleep 2000ms");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("main awake");
        System.out.println("dataA = " + futureDataA.get());
        System.out.println("dataB = " + futureDataB.get());
        System.out.println("dataC = " + futureDataC.get());
        System.out.println("main end");
    }
}
